import { PageContainer } from '@ant-design/pro-components';
import '@umijs/max';
import React, {useEffect, useState} from 'react';
import { Card, Space,Avatar, List } from 'antd';
import { UserOutlined,VerifiedOutlined,CommentOutlined } from '@ant-design/icons';
/**
 * 接口分析
 * @constructor
 */
const InterfaceAnalysis: React.FC = () => {
  const [userInfo, setUserInfo] = useState<API.LoginResult>({});

  useEffect(() => {
    const data = JSON.parse(localStorage.getItem("userInfo"))
    setUserInfo(data)
    console.log(userInfo,'==========',data)
  }, [])

  const back = ()=>{
    history.go(-1);
  }

  return (
    <PageContainer>
        <Space direction="vertical" size={16}>
          <Card title="个人信息" extra={<a href="#" onClick={back} >back</a>} style={{ width: 800,height: 500 }}>
          <Avatar size={64} icon={<UserOutlined />} src={userInfo.userAvatar==''?null:userInfo.userAvatar} />
          <List
              itemLayout="horizontal"
            >
              <List.Item><UserOutlined /> 用户名称 : {userInfo.userName} </List.Item>
              <List.Item><CommentOutlined /> 用户账号 : {userInfo.userAccount} </List.Item>
              <List.Item><VerifiedOutlined/> 用户角色 : {userInfo.userRole} </List.Item>
            </List>
          </Card>
        </Space>
    </PageContainer>
  );
};
export default InterfaceAnalysis;
